package bb.lanxing.model.lushu;

public class WayPointBuilderImpl implements WayPointBuilder {
    String address;
    String content;
    String image;
    int index;
    double lat;
    double lng;
    int status;
    Object tag;
    String title;
    int type;
    int wayPointType;

    public WayPointBuilderImpl(WayPoint wayPoint) {
        this.type = -1;
        this.type = wayPoint.getType();
        this.lat = wayPoint.getLatitude();
        this.lng = wayPoint.getLongitude();
        this.address = wayPoint.getAddress();
        this.title = wayPoint.getTitle();
        this.content = wayPoint.getContent();
        this.wayPointType = wayPoint.getWayPointType();
        this.status = wayPoint.getStatus();
        this.tag = wayPoint.getTag();
    }

    public WayPointBuilderImpl() {
        this.type = -1;
    }

    @Override
    public WayPointBuilder type(int pointType) {
        this.type = pointType;
        return this;
    }

    @Override
    public WayPointBuilder lat(double lat) {
        this.lat = lat;
        return this;
    }

    @Override
    public WayPointBuilder lng(double lng) {
        this.lng = lng;
        return this;
    }

    @Override
    public WayPointBuilder address(String address) {
        this.address = address;
        return this;
    }

    @Override
    public WayPointBuilder title(String title) {
        this.title = title;
        return this;
    }

    @Override
    public WayPointBuilder content(String content) {
        this.content = content;
        return this;
    }

    @Override
    public WayPointBuilder image(String image) {
        this.image = image;
        return this;
    }

    @Override
    public WayPointBuilder wayPointType(int type) {
        this.wayPointType = type;
        return this;
    }

    @Override
    public WayPointBuilder status(int status) {
        this.status = status;
        return this;
    }

    @Override
    public WayPointBuilder tag(Object tag) {
        this.tag = tag;
        return this;
    }

    @Override
    public WayPoint build() {
        if (this.type == -1) {
            throw new IllegalStateException("Illegal point type.");
        }
        return new WayPointImpl(this);
    }
}
